<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <input onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
<script>
window.console.log("ok");

var val1 = parent.navigator.appCodeName;
var val2 = parent.navigator.appName;
var val3 = parent.navigator.appVersion;
var val4 = parent.navigator.userAgent;
console.log("appCodeName:"+val1);
console.log("appName:"+val2);
console.log("appVersion:"+val3);
console.log("userAgent:"+val4);
console.log(window);
console.log(console.time());
console.log(JSON);
// 空,0,未定义  优先false
// 字符串为"" / 者变量为undefined / 数值=0, 为false,方便验空,验0
// 其他情况则为true
if("a"){
    console.log("--a"+true)
}
if("0"){
    console.log("--0"+true);
}
if(" "){
    console.log("--1"+true)
}
if(""){
    console.log("--2"+true)
}
var a;
if(a){
    console.log("--3"+true);
}
let b;
if(b){
    console.log("--4"+true);
}
if(0){
    console.log("--5-0"+true);
}
if(1){
    console.log("--6-1"+true);
}
//toBaidu();
//location.href = "http://www.baidu.com";
function toBaidu(){
    location.href = "http://www.baidu.com";
}
</script>
</body>
</html>